package com.jiang.daily.Q1716;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/10/28 10:54
 */
class Solution {
    public int totalMoney(int n) {
        int quotient = n / 7; // 几个完整的7天
        int remainder = n % 7;

        int res = 28 * quotient + (quotient - 1) * quotient * 7 / 2;
        while (remainder > 0) {
            res += ++quotient;
            remainder--;
        }

        return res;
    }
}
